package com.md.config.nacos;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 刘骄阳
 * 2022-07-19 14:04
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class NacosConfig {

  private String serverAddress;
  private String namespace;
  private String group = "DEFAULT_GROUP";
  /**
   * 获取nacos dataId
   */
  private String dataId;
  private boolean refresh = true;
  private Class<?> cls = String.class;
  private Long timeout = 5000L;
  private String fileExtension = "properties";

  public NacosConfig(final String serverAddress, final String namespace, final String group, final String dataId,
                     final boolean refresh, final Class<?> cls, final String fileExtension) {
    this.serverAddress = serverAddress;
    this.namespace = namespace;
    this.group = group;
    this.dataId = dataId;
    this.refresh = refresh;
    this.cls = cls;
    this.fileExtension = fileExtension;
  }

  public NacosConfig(final String serverAddress, final String namespace, final String group, final String dataId,
                     final boolean refresh, final Class<?> cls) {
    this.serverAddress = serverAddress;
    this.namespace = namespace;
    this.group = group;
    this.dataId = dataId;
    this.refresh = refresh;
    this.cls = cls;
  }
}
